home *** CD-ROM | disk | FTP | other *** search
- (*---------------------------------------------------------------------------
- :Program. IFFBitMapDemo.mod
- :Author. Fridtjof Siebert
- :Address. Nobileweg 67, D-7-Stgt-40
- :Phone. 0711/822509
- :Shortcut. [fbs]
- :Version. 1.0
- :Date. 20.04.88
- :Copyright. PD
- :Language. Modula-II
- :Translator. M2Amiga
- :Imports. IFFLoad [fbs].
- :UpDate. none.
- :Contents. Demo für dontopen-Option von ReadILBM().
- :Remark. Let's wave !!!
- ---------------------------------------------------------------------------*)
- MODULE IFFBitMapDemo;
-
- FROM SYSTEM IMPORT ADR, ADDRESS, SHIFT, BITSET, LONGSET, CAST;
-
- FROM Arguments IMPORT NumArgs,GetArg;
-
- FROM Intuition IMPORT ScreenPtr,CloseScreen,DisplayBeep,WindowPtr,OpenScreen;
- FROM Graphics IMPORT BitMap,BitMapPtr;
- FROM Exec IMPORT FreeMem;
-
- FROM IFFLoad IMPORT ReadILBM,ReadILBMFlags,ReadILBMFlagSet,NuScreen,IFFInfo,
- IFFInfoType;
-
- VAR
- MyScreen: ScreenPtr; (* the Picture's Screen *)
- WindowDummy: WindowPtr; (* a Dummy WindowPointer *)
- Name: ARRAY[0..79] OF CHAR; (* the Pic's Name *)
- length: INTEGER; (* the Name's length (not used) *)
- Ciapra [0BFE001H]: SET OF (s0,s1,s2,s3,s4,s5,lmb); (* left Button *)
- MyBitMap: BitMapPtr; (* for saving BitMapAddress *)
- MyIFFInfo: IFFInfoType; (* for saving IFFInfo *)
- PlaneSize: LONGINT; (* Size of one BitPlane *)
- i: CARDINAL; (* Counts BitPlanes *)
-
- BEGIN
-
- (*------ Get Name: ------*)
-
- IF NumArgs()#0 THEN
- GetArg(1,Name,length);
- ELSE
- HALT;
- END;
-
- (*------ Read ILBM: ------*)
-
- IF ReadILBM(Name,ReadILBMFlagSet{front,visible,dontopen},MyScreen,
- WindowDummy) THEN
-
- (*------ Save important Data: ------*)
-
- MyIFFInfo := IFFInfo;
- MyBitMap := NuScreen.customBitMap;
- (* this needn't be done in this program, but has to, as soon as there *)
- (* are more than one Pictures loaded. So it's done in this Example *)
-
- (*------ Open Screen: ------*)
-
- MyScreen := OpenScreen(NuScreen);
-
- (*------ Wait for left Button: ------*)
-
- WHILE lmb IN Ciapra DO END;
-
- (*------ Close Screen: ------*)
-
- CloseScreen(MyScreen);
-
- (*------ Free BitMap's Memory: ------*)
-
- (* calculate Size of BitPlane: *)
- WITH MyIFFInfo.BMHD DO
- IF scrnWidth>width THEN
- (* If Image is greater than Screen, a bigger BitMap is allocated ! *)
- PlaneSize := scrnWidth;
- ELSE
- PlaneSize := width;
- END;
- IF scrnHeight>height THEN
- PlaneSize := PlaneSize DIV 8 * scrnHeight;
- ELSE
- PlaneSize := PlaneSize DIV 8 * height;
- END;
- END;
- WITH MyBitMap^ DO
- FOR i:=0 TO depth-1 DO
- FreeMem(planes[i],PlaneSize); (* Free Memory of each Plane *)
- END;
- END;
- FreeMem(MyBitMap,SIZE(BitMap)); (* Free Memory of BitMap-Structure *)
-
- ELSE (* any Error occured while loading Picture: *)
-
- DisplayBeep(NIL); (* Let's display a Beep ! *)
-
- END;
-
- END IFFBitMapDemo. Never forget to free BitMap's Memory !!!
-